package com.glory.dgcpcpda.adapter;

import android.view.View;
import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.glory.dgcpcpda.R;
import com.glory.dgcpcpda.entity.LotBindingVehicleEntity;

import java.util.List;

public class VehicleBindingAdapter extends BaseQuickAdapter<LotBindingVehicleEntity, BaseViewHolder> {
    public VehicleBindingAdapter(@Nullable List<LotBindingVehicleEntity> data) {
        super(R.layout.adapter_lot_vehicle_binding, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, LotBindingVehicleEntity item) {
        helper.setText(R.id.tvNo,String.valueOf(helper.getAdapterPosition()+1));
        helper.setText(R.id.tvVehicle,item.getVehicleCode());
        helper.setText(R.id.tvLotID,item.getLotID());
        ImageView ivDelete = helper.getView(R.id.ivDelete);
        ivDelete.setOnClickListener(view -> {
            remove(helper.getAdapterPosition());
            notifyDataSetChanged();
        });
    }
}
